package edu.office.applicationRepository;

import edu.office.entities.Teacherschedule;
import edu.office.tools.EOMessage;
import edu.office.tools.EOMessage1;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Named;

@Named("teacherscheduleRepositoryA")
@ApplicationScoped
public class TeacherscheduleRepository extends ApplicationCommonRepository<Teacherschedule> {
    public String mycreate(Teacherschedule teacherschedule) {
        if (list("select * from TEACHERSCHEDULE where BELONGCLASSID=?1 USERID=?2 ",
                teacherschedule.getBELONGCLASSID(), teacherschedule.getUSERID()).isEmpty()) {
            create(teacherschedule);
            return EOMessage.getEOMessageENUM(EOMessage1.Succeed);
        } else {
            return EOMessage.getEOMessageENUM(EOMessage1.Already_Exist);
        }
    }
}
